package mortal.game.control
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.Game.*;
    import Message.Public.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import flash.events.*;
    import modules.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.model.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.*;
    import mortal.game.scene.ai.*;
    import mortal.game.scene.map.*;
    import mortal.game.scene.player.entity.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.alertwins.*;
    import mortal.game.view.transport.*;
    import mortal.game.view.uiIconBtn.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class TransportController extends Controller
    {
        private var _transport:TransportModule;
        private var _transportInfo:TransportInfoModule;
        private var _transportInsu:TransportInsuModule;
        private var _transportIcon:TransportInfoHintIcon;
        private var _transportHelp:TransportHelpHintIcon;
        private var _insuModuleType:int;
        private var humpHelpInfo:STransportHelpInfo;

        public function TransportController()
        {
            
        }

        public function get transport() : TransportModule
        {
            if (!this._transport)
            {
                this._transport = new TransportModule();
                this._transport.addEventListener(EventName.TransportInfoReq, this.onTransportReq);
                this._transport.addEventListener(EventName.TransportFlushReq, this.onTransportFlushReq);
                this._transport.addEventListener(EventName.TransportBeginReq, this.onTransportBeginReq);
                this._transport.addEventListener(EventName.TransportMoveAward, this.onTransportMoveAward);
                this._transport.addEventListener(EventName.TransportBuyInsuDetails, this.onTransportBuyInsuDetailHandler);
            }
            return this._transport;
        }

        public function get transportInfo() : TransportInfoModule
        {
            if (!this._transportInfo)
            {
                this._transportInfo = new TransportInfoModule();
                this._transportInfo.addEventListener(WindowEvent.CLOSE, this.onTransportInfoCloseHandler);
                this._transportInfo.addEventListener(EventName.TransportBuyInsuDetails, this.onTransportBuyInsuHandler);
            }
            return this._transportInfo;
        }

        public function get transportIcon() : TransportInfoHintIcon
        {
            if (!this._transportIcon)
            {
                this._transportIcon = new TransportInfoHintIcon();
                this._transportIcon.addEventListener(MouseEvent.CLICK, this.onTransIconClickHandler);
            }
            return this._transportIcon;
        }

        public function get transportHelp() : TransportHelpHintIcon
        {
            if (!this._transportHelp)
            {
                this._transportHelp = new TransportHelpHintIcon();
                this._transportHelp.addEventListener(MouseEvent.CLICK, this.onHelpIconClickHandler);
            }
            return this._transportHelp;
        }

        public function get transportBuyInsu() : TransportInsuModule
        {
            if (!this._transportInsu)
            {
                this._transportInsu = new TransportInsuModule();
                this._transportInsu.addEventListener(WindowEvent.CLOSE, this.onTransportInsuCloseHandler);
                this._transportInsu.addEventListener(EventName.TransportBuyInsuReq, this.onTransportInsuReq);
            }
            return this._transportInsu;
        }

        private function onTransportReq(event:DataEvent) : void
        {
            GameProxy.transport.openTransportReq(cache.dialog.npcInfo.tnpc.npcId);
            
        }

        private function onTransportFlushReq(event:DataEvent) : void
        {
            var _loc_2:Array = null;
            var _loc_3:QuickBuyWindow = null;
            if (!cache.dialog.transportInfo.autoBuy && cache.dialog.transportInfo.freeCount == 0)
            {
                _loc_2 = cache.pack.backPackCache.getTypeItems(ECategory._ECategoryProp, EProp._EPropTransportFlushToken);
                if (!_loc_2 || _loc_2.length == 0)
                {
                    _loc_3 = QuickBuyWindow.instance;
                    _loc_3.updateWindow(ECategory._ECategoryProp, EProp._EPropTransportFlushToken);
                    _loc_3.show();
                    
                }
            }
            GameProxy.transport.flushTransportReq(cache.dialog.npcInfo.tnpc.npcId, cache.dialog.transportInfo.autoBuy, cache.dialog.transportInfo.flushCount, cache.dialog.transportInfo.flushColor);
            
        }

        private function onTransportBeginReq(event:DataEvent) : void
        {
            if (cache.login.loginGame.money.coin + cache.login.loginGame.money.coinBind < cache.dialog.transportInfo.cashPledge)
            {
                MsgManager.addBroadCast("押金不足");
                MsgManager.addTipText("押金不足");
                
            }
            if (!this.transport.isHide)
            {
                this.transport.hide();
            }
            GameProxy.transport.beginTranportReq(cache.dialog.npcInfo.tnpc.npcId);
            
        }

        private function onTransportMoveAward(event:DataEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.TransportMoveAward, cache.dialog.transportInfo));
            
        }

        private function onTransportBuyInsuDetailHandler(event:DataEvent) : void
        {
            this._insuModuleType = 1;
            if (this.transportBuyInsu.isHide)
            {
                this.transportBuyInsu.show(this.transport.x + 30, this.transport.y + 30);
            }
            this.transportBuyInsu.updateData(cache.dialog.transportInfo);
            
        }

        private function onTransportBuyInsuHandler(event:DataEvent) : void
        {
            this._insuModuleType = 2;
            if (this.transportBuyInsu.isHide)
            {
                this.transportBuyInsu.show(this.transportInfo.x + 30, this.transportInfo.y + 30);
            }
            this.transportBuyInsu.updateData(cache.dialog.transportInfo);
            
        }

        private function onTransportInsuReq(event:DataEvent) : void
        {
            cache.dialog.transportInfo.insureType = EInsureType._EInsureTypeGold;
            if (this._insuModuleType == 1)
            {
                cache.dialog.transportInfo.insureBuy = true;
                if (!this.transport.isHide)
                {
                    this.transport.updateInsureBuy(cache.dialog.transportInfo);
                }
                if (!this.transportBuyInsu.isHide)
                {
                    this.transportBuyInsu.hide();
                }
            }
            else
            {
                if (cache.login.loginGame.money.gold + cache.login.loginGame.money.goldBind < cache.dialog.transportInfo.insureValue)
                {
                    MsgManager.addBroadCast("元宝不足，无法购买保险");
                    
                }
                cache.dialog.transportInfo.insureBuy = true;
                GameProxy.transport.buyInsurance(cache.dialog.transportInfo.insureType);
                if (!this.transportBuyInsu.isHide)
                {
                    this.transportBuyInsu.hide();
                }
            }
            
        }

        private function onTransportTalkRes(param1:TransportInfo) : void
        {
            if (param1.transportAble)
            {
                GameProxy.transport.openTransportReq(cache.dialog.npcInfo.tnpc.npcId);
            }
            
        }

        private function onTransportInfoRes(param1:TransportInfo) : void
        {
            if (this.transport.isHide)
            {
                this.transport.show();
            }
            this.transport.updateData(param1);
            
        }

        private function onTransTaskInfoRes(param1:TransportInfo) : void
        {
            var _loc_2:Array = null;
            var _loc_3:TaskInfo = null;
            if (cache.guide.transportIng)
            {
                _loc_2 = cache.task.getTaskByGroup(ETaskGroup._ETaskGroupTransport);
                if (_loc_2.length != 0)
                {
                    _loc_3 = _loc_2[0];
                    if (_loc_3 != null)
                    {
                        cache.dialog.transportInfo.taskTarget = _loc_3.getTargetByIndex(0);
                    }
                }
                this.showTransportIcon();
                this.showTransportHelp();
            }
            
        }

        private function onTransportInfoUpdate(param1:TransportInfo) : void
        {
            if (!this.transport.isHide)
            {
                this.transport.updateColor(param1);
            }
            
        }

        private function onTransportBeginRes(param1:TaskInfo) : void
        {
            cache.dialog.transportInfo.taskTarget = param1.getTargetByIndex(0);
            if (RolePlayer.instance.hasMount)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.UnCallMounts));
            }
            this.showTransportIcon();
            this.showTransportHelp();
            if (this.transportInfo.isHide)
            {
                this.transportInfo.show();
                this.transportInfo.updateData(cache.dialog.transportInfo);
            }
            
        }

        private function onTransportBuyInsuRes(param1:Object) : void
        {
            cache.dialog.transportInfo.insureBuy = true;
            MsgManager.addBroadCast("购买保险成功");
            MsgManager.addTipText("购买保险成功");
            
        }

        private function onTransportFailRes(param1:MessageBlock) : void
        {
            var _loc_3:String = null;
            var _loc_2:* = param1.messageBase as STransportFailReward;
            MsgManager.addTipText("灵兽护送失败");
            if (_loc_2.killByPlayer && _loc_2.killerMiniPlayer.name != cache.role.entityInfo.name)
            {
                _loc_3 = "您的灵兽被" + HTMLUtil.addColor(_loc_2.killerMiniPlayer.name, ColorConfig.instance.getCampColor(_loc_2.killerMiniPlayer.camp).color) + "抢夺，护送失败，只能获得" + _loc_2.finalExp + "经验！";
                Alert.show(_loc_3, null, Alert.OK);
            }
            else
            {
                Alert.show("护送失败，获得经验" + HTMLUtil.addColor(_loc_2.finalExp + "", "#ffff00") + "，退还" + HTMLUtil.addColor(_loc_2.cashPledge + "", "#ffff00") + "铜钱押金！", null, Alert.OK);
            }
            this.hideTransportIcon();
            this.hideTransportHelp();
            if (this._transportInfo && !this._transportInfo.isHide)
            {
                this._transportInfo.hide();
            }
            if (this._transportInsu && !this._transportInsu.isHide)
            {
                this._transportInsu.hide();
            }
            AIManager.cancelAll();
            
        }

        private function onTransportHelpRes(param1:MessageBlock) : void
        {
            if (cache.role.entityInfo.level < 30)
            {
                
            }
            var _loc_2:* = param1.messageBase as STransportHelpInfo;
            Alert.timerOut = 15;
            Alert.timerNO = true;
            Alert.alertWinRenderer = TimerAlertWin;
            Alert.buttonWidth = 60;
            Alert.extendObj = _loc_2;
            Alert.show("仙盟成员" + HTMLUtil.addColor(_loc_2.ownerMiniPlayer.name, ColorConfig.instance.getCampColor(_loc_2.ownerMiniPlayer.camp).color) + "护送灵兽遇到危险向您求救，<br>是否传送过去支援？", null, Alert.OK | Alert.CANCEL, null, this.helpAlertHandler);
            
        }

        private function helpAlertHandler(param1:int, param2:Object) : void
        {
            var _loc_3:SceneInfo = null;
            if (param1 == Alert.OK)
            {
                if (cache.task.inTransport())
                {
                    MsgManager.addBroadCast("护送中不能传送");
                    
                }
                if (cache.role.entityInfo.level >= GameConst.SetFightModeLevel)
                {
                    if (RolePlayer.instance.entityInfo.entityInfo.fightModel == EEntityFightMode._EEntityFightModePeace)
                    {
                        if (GameMapUtil.isEnemyMap(param2.mapId))
                        {
                            _loc_3 = SceneConfig.instance.getSceneInfo(param2.mapId);
                            Alert.extendObj = param2;
                            Alert.show("你将前往" + _loc_3.sMapDefine.name + "，进入后将被强制开启为战斗状态。", null, Alert.OK | Alert.CANCEL, null, this.onConveyAlertHandler);
                        }
                        else
                        {
                            this.onConveyAlertHandler(Alert.OK, param2);
                        }
                    }
                    else
                    {
                        this.onConveyAlertHandler(Alert.OK, param2);
                    }
                }
                else if (GameMapUtil.isEnemyMap(param2.mapId))
                {
                    Alert.show("等级不够" + GameConst.SetFightModeLevel + "级，不能进入敌对阵营");
                }
                else
                {
                    this.onConveyAlertHandler(Alert.OK, param2);
                }
            }
            
        }

        private function onConveyAlertHandler(param1:int, param2:Object) : void
        {
            var _loc_3:* = param2 as STransportHelpInfo;
            if (param1 == Alert.OK)
            {
                if (RolePlayer.instance.entityInfo.isStall)
                {
                    Alert.extendObj = _loc_3;
                    Alert.show("该操作会中断摆摊，您确定结束摆摊吗？", null, Alert.OK | Alert.CANCEL, null, this.onStallEndAlertHander);
                }
                else if (cache.trade.isTrading)
                {
                    Alert.extendObj = _loc_3;
                    Alert.show("该操作会中断交易，您确定结束交易吗？", null, Alert.OK | Alert.CANCEL, null, this.onTradEndAlertHander);
                }
                else if (RolePlayer.instance.isDoubleRest)
                {
                    Alert.extendObj = _loc_3;
                    Alert.show("该操作会中断双休，您确定结束双休吗？", null, Alert.OK | Alert.CANCEL, null, this.onRestEndAlertHander);
                }
                else if (cache.fish.isInFishing)
                {
                    Alert.extendObj = _loc_3;
                    Alert.show("该操作会中断钓鱼，您确定结束钓鱼吗？", null, Alert.OK | Alert.CANCEL, null, this.onFishEndAlertHander);
                }
                else
                {
                    GameProxy.sceneProxy.pass(EPassType.EPassTypeTransportHelp, _loc_3.mapId, _loc_3.x, _loc_3.y);
                }
            }
            
        }

        private function onStallEndAlertHander(param1:int, param2:Object) : void
        {
            if (param1 == Alert.OK)
            {
                this.humpHelpInfo = param2 as STransportHelpInfo;
                NetDispatcher.addCmdListener(ServerCommand.StallCloseSuccess, this.onStallCloseSuccess);
                Dispatcher.dispatchEvent(new DataEvent(EventName.StallEndStall));
            }
            
        }

        private function onStallCloseSuccess(param1:Object) : void
        {
            NetDispatcher.removeCmdListener(ServerCommand.StallCloseSuccess, this.onStallCloseSuccess);
            GameProxy.sceneProxy.pass(EPassType.EPassTypeTransportHelp, this.humpHelpInfo.mapId, this.humpHelpInfo.x, this.humpHelpInfo.y);
            
        }

        private function onTradEndAlertHander(param1:int, param2:Object) : void
        {
            if (param1 == Alert.OK)
            {
                this.humpHelpInfo = param2 as STransportHelpInfo;
                Dispatcher.addEventListener(EventName.Trade_CancelSuccess, this.onTradeCancelSuccess);
                GameController.trade.view.hide();
            }
            
        }

        private function onTradeCancelSuccess(event:DataEvent) : void
        {
            Dispatcher.removeEventListener(EventName.Trade_CancelSuccess, this.onTradeCancelSuccess);
            GameProxy.sceneProxy.pass(EPassType.EPassTypeTransportHelp, this.humpHelpInfo.mapId, this.humpHelpInfo.x, this.humpHelpInfo.y);
            
        }

        private function onRestEndAlertHander(param1:int, param2:Object) : void
        {
            var _loc_3:STransportHelpInfo = null;
            if (param1 == Alert.OK)
            {
                _loc_3 = param2 as STransportHelpInfo;
                GameProxy.sceneProxy.pass(EPassType.EPassTypeTransportHelp, _loc_3.mapId, _loc_3.x, _loc_3.y);
            }
            
        }

        private function onFishEndAlertHander(param1:int, param2:Object) : void
        {
            var _loc_3:STransportHelpInfo = null;
            if (param1 == Alert.OK)
            {
                _loc_3 = param2 as STransportHelpInfo;
                GameProxy.sceneProxy.pass(EPassType.EPassTypeTransportHelp, _loc_3.mapId, _loc_3.x, _loc_3.y);
            }
            
        }

        private function onTaskEndRes(param1:Object) : void
        {
            var _loc_2:TaskInfo = null;
            var _loc_3:int = 0;
            var _loc_4:TaskActInfo = null;
            if (param1 && param1.task)
            {
                _loc_2 = param1.task;
                if (_loc_2.sTask.group == ETaskGroup._ETaskGroupTransport)
                {
                    this.hideTransportIcon();
                    this.hideTransportHelp();
                    if (this._transportInfo && this._transportInfo.parent)
                    {
                        this._transportInfo.hide();
                    }
                    if (this._transportInsu && this._transportInsu.parent)
                    {
                        this._transportInsu.hide();
                    }
                    if (cache.daily.serverOpenDay == 1 && cache.dialog.transportInfo.count == 1)
                    {
                    }
                    else
                    {
                        _loc_3 = cache.dialog.transportInfo.maxCount - cache.dialog.transportInfo.count;
                        if (_loc_3 > 0)
                        {
                            Alert.showCloseBtn = true;
                            Alert.okLabel = "继续护送";
                            Alert.calcelLabel = "稍后护送";
                            Alert.buttonWidth = 60;
                            Alert.show("您完成护送灵兽任务，获得" + HTMLUtil.addColor(cache.dialog.transportInfo.rewardExp + "", "#ff00ff") + "经验，今日还可继续护送" + HTMLUtil.addColor(_loc_3 + "", "#00ff00") + "次。", null, Alert.OK | Alert.CANCEL, null, this.onContinueTransHandler);
                        }
                        else
                        {
                            _loc_4 = cache.task.getNearlyActiveDaily();
                            if (_loc_4 != null)
                            {
                                Alert.showCloseBtn = true;
                                Alert.okLabel = "自动前往";
                                Alert.calcelLabel = "取  消";
                                Alert.buttonWidth = 60;
                                Alert.extendObj = _loc_4.dailyInfo;
                                Alert.show("您完成护送灵兽任务，获得" + HTMLUtil.addColor(cache.dialog.transportInfo.rewardExp + "", "#ff00ff") + "经验，今日还可完成" + HTMLUtil.addColor(_loc_4.dailyInfo.name, "#00ff00") + "，获得海量经验。", null, Alert.OK | Alert.CANCEL, null, this.onDoDailyHandler);
                            }
                        }
                    }
                }
            }
            
        }

        private function onDoDailyHandler(param1:int, param2:DailyInfo) : void
        {
            if (param1 == Alert.OK)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.DailyActiveGoTo, param2));
            }
            
        }

        private function onContinueTransHandler(param1:int) : void
        {
            if (param1 == Alert.OK)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.ConveyToReq, cache.scene.getTransportTarget()));
            }
            
        }

        private function onTaskUpdatesRes(param1:Array) : void
        {
            var _loc_2:TaskInfo = null;
            if (param1.length > 0)
            {
                _loc_2 = param1[0];
                if (_loc_2 && _loc_2.sTask.group == ETaskGroup._ETaskGroupTransport && _loc_2.status == ETaskStatus._ETaskStatusHadFail)
                {
                    this.hideTransportIcon();
                    if (this._transportInfo && this._transportInfo.parent)
                    {
                        this._transportInfo.hide();
                    }
                }
            }
            
        }

        private function onTaskListRes(param1:Array) : void
        {
            if (cache.guide.transportIng)
            {
                GameProxy.transport.transportTaskInfoReq(0);
            }
            
        }

        private function onTaskDelRes(param1:Object) : void
        {
            if (!cache.guide.transportIng)
            {
                this.hideTransportIcon();
                this.hideTransportHelp();
                if (this._transportInfo && this._transportInfo.parent)
                {
                    this._transportInfo.hide();
                }
                if (this._transportInsu && this._transportInsu.parent)
                {
                    this._transportInsu.hide();
                }
            }
            
        }

        private function onKillTransRewardRes(param1:MessageBlock) : void
        {
            var _loc_4:ItemInfo = null;
            var _loc_2:* = param1.messageBase as SKillTransportReward;
            var _loc_3:* = "成功抢夺" + HTMLUtil.addColor(_loc_2.ownerMiniPlayer.name, ColorConfig.instance.getCampColor(_loc_2.ownerMiniPlayer.camp).color) + "的" + HTMLUtil.addColor("灵兽", ColorConfig.instance.getItemColor(_loc_2.transportColor).color);
            if (_loc_2.rewardExp > 0)
            {
                _loc_3 = _loc_3 + ("，获得" + _loc_2.rewardExp + "经验");
            }
            if (_loc_2.rewardCoin > 0)
            {
                _loc_3 = _loc_3 + ("，获得" + _loc_2.rewardCoin + "铜钱");
            }
            if (_loc_2.rewardItemAmount > 0)
            {
                _loc_4 = ItemConfig.instance.getInfoByCode(_loc_2.rewardItemCode);
                _loc_3 = _loc_3 + ("，获得" + _loc_2.rewardItemAmount + "颗" + HTMLUtil.addColor(_loc_4.item.name, ColorConfig.instance.getItemColor(_loc_4.item.color).color));
            }
            _loc_3 = _loc_3 + "！";
            Alert.buttonWidth = 100;
            Alert.okLabel = "确  定";
            Alert.show(_loc_3, null, Alert.OK);
            
        }

        public function showTrans() : void
        {
            this.showTransportIcon();
            
        }

        public function hideIcon() : void
        {
            this.hideTransportIcon();
            this.hideTransportHelp();
            if (this._transportInfo && this._transportInfo.parent)
            {
                this._transportInfo.hide();
            }
            if (this._transportInsu && this._transportInsu.parent)
            {
                this._transportInsu.hide();
            }
            
        }

        private function onTransportInfoCloseHandler(event:WindowEvent) : void
        {
            this.showTransportIcon(false);
            
        }

        private function onTransportInsuCloseHandler(event:WindowEvent) : void
        {
            this.showTransportIcon(false);
            
        }

        private function showTransportIcon(param1:Boolean = false) : void
        {
            if (!this.transportIcon.parent && cache.guide.transportIng && this.transportInfo.isHide && this.transportBuyInsu.isHide)
            {
                UiHintIconView.instance.addHintIcon(this.transportIcon, param1);
            }
            
        }

        private function hideTransportIcon() : void
        {
            if (this._transportIcon && this._transportIcon.parent)
            {
                this._transportIcon.parent.removeChild(this._transportIcon);
                EffectManager.glowFilterUnReg(this._transportIcon);
                this._transportIcon.dispatchEvent(new UIIconEvent(UIIconEvent.RemoveIcon));
            }
            
        }

        private function showTransportHelp(param1:Boolean = false) : void
        {
            if (!this.transportHelp.parent && cache.guide.transportIng)
            {
                UiHintIconView.instance.addHintIcon(this.transportHelp, param1);
            }
            
        }

        private function hideTransportHelp() : void
        {
            if (this._transportHelp && this._transportHelp.parent)
            {
                this._transportHelp.parent.removeChild(this._transportHelp);
                EffectManager.glowFilterUnReg(this._transportHelp);
                this._transportHelp.dispatchEvent(new UIIconEvent(UIIconEvent.RemoveIcon));
            }
            
        }

        private function onTransIconClickHandler(event:MouseEvent) : void
        {
            this.transportInfo.updateData(cache.dialog.transportInfo);
            this.transportInfo.show();
            
        }

        private function onHelpIconClickHandler(event:MouseEvent) : void
        {
            if (cache.guild.myGuildInfo == null)
            {
                MsgManager.addBroadCast("你没有仙盟，无法向仙盟求救，请尽快申请加入仙盟哦~~");
            }
            else
            {
                Alert.show("你现在是否要向仙盟发出求救信息？<br><font color=\'#00ff00\'>（每次护送只有一次求救机会哦）</font>", null, Alert.OK | Alert.CANCEL, null, this.onHelpIconAlertHandler);
            }
            
        }

        private function onHelpIconAlertHandler(param1:int) : void
        {
            if (param1 == Alert.OK)
            {
                GameProxy.transport.helpTransportReq();
                this.hideTransportHelp();
            }
            
        }

        override protected function initServer() : void
        {
            super.initServer();
            NetDispatcher.addCmdListener(ServerCommand.TransportTalkRes, this.onTransportTalkRes);
            NetDispatcher.addCmdListener(ServerCommand.TransportInfoRes, this.onTransportInfoRes);
            NetDispatcher.addCmdListener(ServerCommand.TransportInfoUpdate, this.onTransportInfoUpdate);
            NetDispatcher.addCmdListener(ServerCommand.TransportBegin, this.onTransportBeginRes);
            NetDispatcher.addCmdListener(ServerCommand.TransportBuyInsuRes, this.onTransportBuyInsuRes);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateTransportFail, this.onTransportFailRes);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateTransportHelp, this.onTransportHelpRes);
            NetDispatcher.addCmdListener(ServerCommand.TransportTaskInfoRes, this.onTransTaskInfoRes);
            NetDispatcher.addCmdListener(ServerCommand.TaskEndRes, this.onTaskEndRes);
            NetDispatcher.addCmdListener(ServerCommand.TaskUpdate, this.onTaskUpdatesRes);
            NetDispatcher.addCmdListener(ServerCommand.TaskListRes, this.onTaskListRes);
            NetDispatcher.addCmdListener(ServerCommand.TaskDel, this.onTaskDelRes);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateKillTransportReward, this.onKillTransRewardRes);
            
        }

        override protected function initView() : IView
        {
            this._transport = new TransportModule();
            return this._transport;
        }

    }
}
